package medium子集;

import java.util.ArrayList;
import java.util.List;

public class Solution {
    public List<List<Integer>> subsets(int[] nums) {
        List<List<Integer>> list = new ArrayList<>();
        List<Integer> list1 = new ArrayList<>();
        int n = nums.length;
        sets(list,list1,nums,n,0);
        return list;
    }
    public void sets(List<List<Integer>> list, List<Integer> list1, int[] nums, int n, int i){
        if (i>=n){
            list.add(new ArrayList<>(list1));
        }
        else {
            list1.add(nums[n-i-1]);
            sets(list,list1,nums,n,i+1);
            list1.remove(list1.size() - 1);
            sets(list,list1,nums,n,i+1);

        }
    }
}
